import { NextResponse } from 'next/server'; import { getCurrentUser } from '@/lib/auth/session'; import { listVariants } from '@/lib/account/queries'; export const dynamic = 'force-dynamic'; export async function GET(_req: Request, ctx: { params: Promise<{ id: string }> }) { if (!(await getCurrentUser())) return NextResponse.json({ error: 'unauthorized' }, { status: 401 }); const { id } = await ctx.params; const rows = await listVariants(id); return NextResponse.json(rows.map((r) => ({ id: r.v.id, label: r.v.label, rivUsd: r.s?.rivUsd ?? null }))); }